package com.tsign.demo.controller;

import com.tsign.demo.domain.ApiResponse;
import com.tsign.demo.domain.TestAccount;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "test")
public class Demo1Controller {
    /**
     *
     * @param code
     * @return
     */
    @GetMapping("/test")
    @ApiOperation(value = "test", notes = "测试接口",response = TestAccount.class)
    @ApiImplicitParam(name = "code",value = "编码",dataType = "String")
    public ApiResponse<TestAccount> test(String code){
        TestAccount testAccount = new TestAccount().builder().sex(0).password("123sdf54&%^^").username("demaxiya").build();
        return new ApiResponse("200","test",testAccount);
    }

    @GetMapping("/test2")
    @ApiOperation(value = "test", notes = "测试接口",response = TestAccount.class)
    @ApiImplicitParam(name = "code",value = "编码",dataType = "String")
    public ApiResponse<TestAccount> test2(@RequestBody @ApiParam(name = "playJson",value = "传入JSON对象") TestAccount testAccounts){
        TestAccount testAccount = new TestAccount().builder().sex(0).password("123sdf54&%^^").username("demaxiya").build();
        return new ApiResponse("200","test",testAccount);
    }

}
